﻿<%@ Page Title="Accueil" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="ItemTest.aspx.cs" Inherits="Cirrus.ItemTest" %>


<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="Id" 
        DataSourceID="SqlDataSource1" 
        EmptyDataText="There are no data records to display.">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                ShowSelectButton="True" />
            <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" 
                SortExpression="Id" />
            <asp:BoundField DataField="Nom" HeaderText="Nom" SortExpression="Nom" />
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description" />
            <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
            <asp:BoundField DataField="Quantite" HeaderText="Quantite" 
                SortExpression="Quantite" />
            <asp:BoundField DataField="Unite" HeaderText="Unite" SortExpression="Unite" />
            <asp:BoundField DataField="PrixInitial" HeaderText="PrixInitial" 
                SortExpression="PrixInitial" />
            <asp:BoundField DataField="Categorie" HeaderText="Categorie" 
                SortExpression="Categorie" />
            <asp:BoundField DataField="DateInitiale" HeaderText="DateInitiale" 
                SortExpression="DateInitiale" />
        </Columns>
    </asp:GridView>
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        DataKeyNames="Id" DataSourceID="SqlDataSource1" DefaultMode="Insert" 
        Height="50px" Width="125px">
        <Fields>
            <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
                ReadOnly="True" SortExpression="Id" />
            <asp:BoundField DataField="Nom" HeaderText="Nom" SortExpression="Nom" />
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description" />
            <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
            <asp:BoundField DataField="Quantite" HeaderText="Quantite" 
                SortExpression="Quantite" />
            <asp:BoundField DataField="Unite" HeaderText="Unite" SortExpression="Unite" />
            <asp:BoundField DataField="PrixInitial" HeaderText="PrixInitial" 
                SortExpression="PrixInitial" />
            <asp:BoundField DataField="Categorie" HeaderText="Categorie" 
                SortExpression="Categorie" />
            <asp:BoundField DataField="DateInitiale" HeaderText="DateInitiale" 
                SortExpression="DateInitiale" />
            <asp:CommandField ShowInsertButton="True" />
        </Fields>
    </asp:DetailsView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:CirrusConnectionString1 %>" 
        DeleteCommand="DELETE FROM [Item] WHERE [Id] = @Id" 
        InsertCommand="INSERT INTO [Item] ([Nom], [Description], [Type], [Quantite], [Unite], [PrixInitial], [Categorie], [DateInitiale]) VALUES (@Nom, @Description, @Type, @Quantite, @Unite, @PrixInitial, @Categorie, @DateInitiale)" 
        ProviderName="<%$ ConnectionStrings:CirrusConnectionString1.ProviderName %>" 
        SelectCommand="SELECT [Id], [Nom], [Description], [Type], [Quantite], [Unite], [PrixInitial], [Categorie], [DateInitiale] FROM [Item]" 
        UpdateCommand="UPDATE [Item] SET [Nom] = @Nom, [Description] = @Description, [Type] = @Type, [Quantite] = @Quantite, [Unite] = @Unite, [PrixInitial] = @PrixInitial, [Categorie] = @Categorie, [DateInitiale] = @DateInitiale WHERE [Id] = @Id">
        <DeleteParameters>
            <asp:Parameter Name="Id" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Nom" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="Type" Type="String" />
            <asp:Parameter Name="Quantite" Type="Double" />
            <asp:Parameter Name="Unite" Type="String" />
            <asp:Parameter Name="PrixInitial" Type="String" />
            <asp:Parameter Name="Categorie" Type="String" />
            <asp:Parameter Name="DateInitiale" Type="DateTime" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Nom" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="Type" Type="String" />
            <asp:Parameter Name="Quantite" Type="Double" />
            <asp:Parameter Name="Unite" Type="String" />
            <asp:Parameter Name="PrixInitial" Type="String" />
            <asp:Parameter Name="Categorie" Type="String" />
            <asp:Parameter Name="DateInitiale" Type="DateTime" />
            <asp:Parameter Name="Id" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>

</asp:Content>

